//go:build wireinject

package main

import (
	"gitee.com/zhyclouds/fable-scribe/internal/repository"
	"gitee.com/zhyclouds/fable-scribe/internal/repository/dao"
	"gitee.com/zhyclouds/fable-scribe/internal/service"
	"gitee.com/zhyclouds/fable-scribe/internal/service/image/seedream"
	"gitee.com/zhyclouds/fable-scribe/internal/service/text/volcengine"
	"gitee.com/zhyclouds/fable-scribe/internal/web"
	"gitee.com/zhyclouds/fable-scribe/internal/web/jwt"
	"gitee.com/zhyclouds/fable-scribe/ioc"
	"github.com/gin-gonic/gin"
	"github.com/google/wire"
)

var thirdPartySet = wire.NewSet(
	ioc.InitDB,
	ioc.InitRedis,
	ioc.InitLogger,
	ioc.NewS3,
	ioc.NewSnowflakeNode,
	ioc.NewMongoDB,
	jwt.NewRedisJWTHandler,
)

var userHandlerSet = wire.NewSet(
	dao.NewGROMUserDAO,
	repository.NewGORMUserRepository,
	service.NewUserService,
	web.NewUserHandler,
)

var drawHandlerSet = wire.NewSet(
	dao.NewMongoDBComicDAO,
	dao.NewComicS3DAO,
	repository.NewMongoDBComicRepository,

	seedream.NewSeedreamImageService,
	volcengine.NewVolcengineTextService,

	service.NewMultiTurnComicService,
	web.NewComicHandler,
)

func InitWebServer() *gin.Engine {
	wire.Build(
		thirdPartySet,
		userHandlerSet,
		drawHandlerSet,

		ioc.InitGinMiddlewares,
		ioc.InitWeb,
	)

	return new(gin.Engine)
}
